package com.distributed.kv.dto;

import java.util.List;

/**
 * 批量响应对象
 */
public class BatchResponse<T> {

    private List<T> results;
    private List<String> errors;
    private int totalCount;
    private int successCount;
    private int errorCount;
    private long processingTimeMs;

    public BatchResponse() {
    }

    public BatchResponse(List<T> results, List<String> errors) {
        this.results = results;
        this.errors = errors;
        this.totalCount = (results != null ? results.size() : 0) + (errors != null ? errors.size() : 0);
        this.successCount = results != null ? results.size() : 0;
        this.errorCount = errors != null ? errors.size() : 0;
    }

    public List<T> getResults() {
        return results;
    }

    public void setResults(List<T> results) {
        this.results = results;
    }

    public List<String> getErrors() {
        return errors;
    }

    public void setErrors(List<String> errors) {
        this.errors = errors;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getSuccessCount() {
        return successCount;
    }

    public void setSuccessCount(int successCount) {
        this.successCount = successCount;
    }

    public int getErrorCount() {
        return errorCount;
    }

    public void setErrorCount(int errorCount) {
        this.errorCount = errorCount;
    }

    public long getProcessingTimeMs() {
        return processingTimeMs;
    }

    public void setProcessingTimeMs(long processingTimeMs) {
        this.processingTimeMs = processingTimeMs;
    }
}
